import request from '@/utils/request'

/**
 * 查询用户消息列表
 * @param {*} query
 */
export function fetchList(query) {
  return request({
    url: '/base/user/message/list',
    method: 'get',
    params: query
  })
}

export function readAll() {
  return request({
    url: '/base/user/message/readAll',
    method: 'post'
  })
}

/**
 * 用户阅读消息
 * @param {*} message
 */
export function readMessage(msgId) {
  return request({
    url: '/base/user/message/read',
    method: 'post',
    params: { msgId }
  })
}

/**
 * 获取用户未读消息记录数
 */
export function countUnreadMessage() {
  return request({
    url: '/base/user/message/count',
    method: 'get'
  })
}

/**
 * 发送新消息
 * @param {*} baseMessageInfo
 */
export function sendMessage(baseMessageInfo) {
  return request({
    url: '/base/user/message/send',
    method: 'post',
    data: baseMessageInfo
  })
}
